<template>
  <div>
    <div>年: {{ year }}</div>
    <div>月<small>(月份从0开始，所以要+1)</small>: {{ month + 1 }}</div>
    <div>日: {{ day }}</div>
    <div>时: {{ hour }}</div>
    <div>分: {{ minute }}</div>
    <div>秒: {{ second }}</div>
    <div>毫秒: {{ millisecond }}</div>
  </div>
</template>

<script setup>
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

let year = dayjs().get('year')
console.log('year', year)
let month = dayjs().get('month')
console.log('month', month)
let day = dayjs().get('date')
console.log('day', day)
let hour = dayjs().get('hour')
console.log('hour', hour)
let minute = dayjs().get('minute')
console.log('minute', minute)
let second = dayjs().get('second')
console.log('second', second)
let millisecond = dayjs().get('millisecond')
console.log('millisecond', millisecond)
</script>
